class NumError(BaseException):
    def __init__(self, err_msg):
        self.err_msg = {'code': 70011, 'message': '请求参数错误'}
        self.err_msg_detail = "请求参数错误" + err_msg
        Exception.__init__(self, self.err_msg, self.err_msg_detail)


import math as m
from functools import lru_cache
import _mainlib


def abs(number):
    return (number ** 2) ** 0.5


def sqrt(number):
    return number ** 0.5



def hlgs(l1, l2, l3):  # 海伦公式
    p = l1 + l2 + l3
    p /= 2
    s = sqrt(p * (p - l1) * (p - l2) * (p - l3))
    return s


def acos(x):
    return m.acos(x)


def asin(x):
    return m.asin(x)


def atan(x):
    return m.atan(x)


def four_op(a, op, b):
    if op == '+':
        return plus(a, b)
    if op == '-':
        # TODO: make a - b ansner
        return minute(a, b)
    elif op == '*':
        # TODO: make a * b ansner
        return multiplication(a, b)
        pass
    elif op == '/':
        # TODO: make a / b ansner
        return division(a, b)
    else:
        # TODO: raise op wrong
        raise Exception(f'op can\'t {op})')


def plus(a1, a2):
    return a1 + a2


def minute(a1, a2):
    return a1 - a2


def multiplication(a1, a2):
    return a1 * a2


def division(a1, a2):
    return a1 / a2


def mo(a1, a2):
    return a1 % a2


# @lru_cache
def Factorial(i: int):  # 阶乘（递归）
    '''
    i : i的阶乘
    '''
    if i == 0:    return 1
    if i == 1:
        return 1
    else:
        return i * Factorial(i - 1)


@_mainlib.GetRunTime
def test():
    Factorial(100)


def PascalsTriangle(row=20):
    '''
    row : 返回前多少行的阵列
    '''
    List = []
    for x in range(row):
        L2 = []
        List.append(L2)
        for y in range(x + 1):
            L2.append(ADisorderlyPicking1(y, x))
        List = List[:]
    return List


@lru_cache
def like_fib1(end_index, i1=1, i2=2):
    if end_index == 1:  return i1
    if end_index == 2:
        return i2
    else:
        return like_fib1(end_index - 1, i1, i2) + like_fib1(end_index - 2, i1, i2)


def ADisorderlyPicking1(high, low):
    '''
    high : 顶数
    low : 底数
    
      low
    C
      high
    '''
    if high > low:
        raise NumError(f'顶数<{high}>不能大于底数<{low}>')
    value = Factorial(low) / (Factorial(high) * Factorial(low - high))
    return int(value)


def MAXFactor(a, b):
    '''最大公因数'''
    if a < b:    a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b


def MINMultiple(a, b):
    '''最小公倍数'''
    return (a * b) / MAXFactor(a, b)


if __name__ == '__main__':
    print(MINMultiple(6, 4))
